const app = getApp()

Page({
  data: {
    collectionList: []
  },

  onLoad: function() {
    this.getCollectionList()
  },

  onShow: function() {
    this.getCollectionList()
  },

  getCollectionList: function() {
    wx.cloud.callFunction({
      name: 'db',
      data: {
        action: 'getCollectionRecords'
      }
    }).then(res => {
      if (res.result.success) {
        this.setData({
          collectionList: res.result.records
        })
      } else {
        wx.showToast({
          title: '获取收藏列表失败',
          icon: 'none'
        })
      }
    }).catch(err => {
      console.error('获取收藏列表失败:', err)
      wx.showToast({
        title: '获取收藏列表失败',
        icon: 'none'
      })
    })
  }
}) 